﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Business;

namespace GestorEventos
{
    public partial class editArtista : System.Web.UI.Page
    {
        Artista art;

        protected void Page_Load(object sender, EventArgs e)
        {

            int artistID = -369;
            int status;
            bool value;
            if (Request.QueryString["artistID"] != null && Session["userStatus"] != null)
            {
                artistID = Convert.ToInt32(Request.QueryString["artistID"].ToString());
                status = Convert.ToInt32(Session["userStatus"].ToString());
                if (Page.IsPostBack)
                {

                    String nome = TextBoxNome.Text;
                    String descricao = TextBoxDescricao.Text;
                    String link = TextBoxURL.Text;

                    Artista art = new Artista(nome, descricao, link);
                    art.setIDArtista(artistID);
                    value = art.updateArtista();

                    if (value)
                    {

                        Response.Redirect("viewArtista.aspx?artistID=" + artistID + "");
                    }
                }
                else
                {


                    Artista a = new Artista();
                    Artista art = a.getArtistaByID(artistID);

                    TextBoxNome.Text = art.getNomeArtista();
                    TextBoxDescricao.Text = art.getDescricaoArtista();
                    TextBoxURL.Text = art.getLinkArtista();



                    // Utilizador
                    if (status >= 1)
                    {
                    }

                    // Moderador
                    if (status > 1)
                    {
                    }

                    // Administrador
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }


        public void editarArtista(Object o, EventArgs e)
        {

        }


    }
}
